var cc__decorate = __decorate;
var cc__awaiter = __awaiter;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2gameBefore = require("gameBefore");
var $2ConstValue = require("ConstValue");
var $2GameUser = require("GameUser");
var $2EventCenter = require("EventCenter");
var $2EventDefine = require("EventDefine");
var $2UIManager = require("UIManager");
var $2Platformconf = require("Platformconf");
var $2PlatformMgr = require("PlatformMgr");
var $2ccUtil = require("ccUtil");
var $2UIHelp = require("UIHelp");
var $2BaseUIPopup = require("BaseUIPopup");
var $2UISidebar = require("UISidebar");
var $2UIVMain = require("UIVMain");
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var def_UIPtili = /* */function (_p$default2) {
  function _ctor() {
    babel_classCallCheck(this, _ctor);
    return _callSuper(this, _ctor, arguments);
  }
  babel_inherits(_ctor, _p$default2);
  return babel_createClass(_ctor, [{
    key: "onShow",
    value: function onShow() {
      babel_get(babel_getPrototypeOf(_ctor.prototype), "onShow", this).call(this);
      $2Platformconf.default.PlatformType === $2Platformconf.ePlatformType.WXGame && cc.Canvas.instance.node.getComponent($2gameBefore.default).BannerShow();
      if ($2ConstValue.ConstValue.PlayerOnLineTime >= 60) {
        if ($2Platformconf.default.PlatformType === $2Platformconf.ePlatformType.TTGame) {
          $2ConstValue.ConstValue.InterAdIntervalTime <= 0 && $2PlatformMgr.default.Instance().interstitialShow(0);
        } else {
          $2Platformconf.default.PlatformType === $2Platformconf.ePlatformType.KWaiGame && $2ConstValue.ConstValue.InterAdIntervalTime <= 0 && $2PlatformMgr.default.Instance().interstitialShow(0);
        }
      }
      null != $2UIManager.UIManager.getInstance().getUI($2UIVMain.default) && $2UIManager.UIManager.getInstance().getUI($2UIVMain.default).hideYXQ();
    }
  }, {
    key: "click",
    value: function click(e, t) {
      var _this130 = this;
      babel_get(babel_getPrototypeOf(_ctor.prototype), "click", this).call(this, e, t);
      var n = e.getCurrentTarget();
      if ("close" == t) {
        if (cc.sys.platform === cc.sys.BYTEDANCE_GAME) {
          var _e75 = $2GameUser.default.getInstance().getSidebarRewardClaimState();
          if ($2GameUser.default.getInstance().tili <= 0 && !_e75) {
            $2UIManager.UIManager.getInstance().showUI($2UISidebar.default);
            return void this.close();
          }
        }
        null != $2UIManager.UIManager.getInstance().getUI($2UIVMain.default) && $2UIManager.UIManager.getInstance().getUI($2UIVMain.default).showYXQ();
        this.close();
        $2EventCenter.default.postEvent($2EventDefine.default.GAME_TILI_INFO_UPDATE);
        $2UIManager.UIManager.getInstance().getUI($2UIVMain.default).isHome || $2ConstValue.ConstValue.PlayerOnLineTime >= 60 && $2Platformconf.default.PlatformType === $2Platformconf.ePlatformType.WXGame && $2ConstValue.ConstValue.InterAdIntervalTime <= 0 && $2PlatformMgr.default.Instance().interstitialShow(0);
      } else {
        "gettili" == n.name && $2PlatformMgr.default.Instance().play_AD(function (e) {
          return cc__awaiter(_this130, undefined, undefined, /* */babel_regeneratorRuntime().mark(function _callee9() {
            return babel_regeneratorRuntime().wrap(function _callee9$(_context10) {
              while (1) {
                switch (_context10.prev = _context10.next) {
                  case 0:
                    _context10.t0 = e;
                    if (!_context10.t0) {
                      _context10.next = 9;
                      break;
                    }
                    cc.Canvas.instance.node.getComponent($2gameBefore.default).BannerHide();
                    $2GameUser.default.getInstance().tili += 3;
                    $2UIHelp.UIHelp.showTip("体力+3");
                    _context10.next = 7;
                    return $2ccUtil.default.goldFlyEffect();
                  case 7:
                    $2EventCenter.default.postEvent($2EventDefine.default.GAME_TILI_INFO_UPDATE);
                    this.close();
                  case 9:
                  case "end":
                    return _context10.stop();
                }
              }
            }, _callee9, this);
          }));
        }, {
          videoid: 1,
          origin: "levelPlayAD"
        });
      }
    }
  }]);
}($2BaseUIPopup.default);
def_UIPtili.className = "UIPtili";
def_UIPtili = cc__decorate([ccp_ccclass], def_UIPtili);
exports.default = def_UIPtili;